//For use in dojo 1.8

define(
   [
      'dojo/_base/declare',
      'dojox/mobile/ProgressIndicator'
   ],
   function(declare, ProgressIndicator)
   {
      return declare("noBusinessBase.mobile.ProgressIndicator", [ProgressIndicator],
      {
         constructor: function(args)
         {
            dojo.safeMixin(this, args);
         },
         postscript: function(args)
         {
            this.inherited(arguments);
            this.mReferences = 0;
            this.mSpinning = this.startSpinning;
         },
         addReference: function()
         {
            this.mReferences++;
            if(this.mReferences > 0 && !this.mSpinning)
            {
               this.start();
               this.mSpinning = true;
            }
         },
         removeReference: function()
         {
            this.mReferences--;
            if(this.mReferences <= 0 && this.mSpinning)
            {
               this.mReferences = 0;
               this.stop();
            }
         }
      });
   }
);
